The present invention relates to a device for, a method of and a program for writing transaction data into a disk. The system, the method and the program are capable of, in online transaction processing (OLTP) and the like, dynamically switching modes for writing transaction data into a disk, depending on dynamic variations in load and on a failure in a process and hardware, between a write-through mode and a write-behind mode.
In an online transaction processing application such as a securities transaction system, it is not allowed to lose committed data due to a failure. Normally, as a method of guaranteeing data durability against a failure, a write-through mode by which data are directly written into a disk at the time of commitment is used.
Conventionally, because writing data into a disk generally involves high latency and a low throughput, a write-behind mode has been used as a technique for improving the above problems. FIG. 1 concisely illustrates data write processing in the write-behind mode. In the write-behind mode, first of all, data are made redundant at the time of commitment by temporarily copying the data in a memory (e.g., remote memory) located on a different node or a different process (101). A location and a configuration of the remote memory into which the data are copied depend on what kinds of failures are desired to be endured. After the completion of the commitment, data on a memory in a local process (local memory) are asynchronously written into a disk (102). Even when a failure occurs before the data are written into the disk, the data can be restored from the remote memory (103). Upon completion of writing the data into the disk, the data is deleted from the local memory and the remote memory (104). Since a memory has a higher data writing rate than a disk, the application can reduce latency and improve a throughput.
However, it has been a common practice that data durability guarantee, which is to switch modes between a write-through mode and a write-behind mode, is statically set up prior to activation of an application. In that practice, it has been impossible to dynamically switch the modes therebetween in response to a change in load or a failure in either a process or hardware during execution of the application.
Japanese Patent Application Publication No. Hei9-93265.
Using a remote memory, instead of a disk, as a storage for data at time of commitment, makes it possible to improve latency of the transaction data while guaranteeing durability thereof. However, a memory is expensive as compared with a disk, and hence results in a small capacity. Therefore, in the write-behind mode, if more than a certain amount of committed data is accumulated in a memory within a certain time period, a used capacity of the memory reaches a limit thereof. Thereby, it becomes impossible to additionally save committed data. As a result, the data overflows the memory. On the other hand, if the transaction data are configured to wait for being written into a disk for the purpose of preventing this, write disk processing becomes a bottle neck.